package com.deram.ctin.serv.business.impl;

import com.deram.ctin.common.bean.PageResult;
import com.deram.ctin.serv.business.api.BusinessShareholderApi;
import com.deram.ctin.serv.business.entity.BaseUpdateInfo;
import com.deram.ctin.serv.business.entity.BusinessShareholder;
import com.deram.ctin.serv.business.filter.BusinessShareholderFilter;
import com.deram.ctin.serv.business.service.BusinessShareholderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: jtt
 * @Description:
 * @Date: 2017/9/13 16:00
 * @version: V1.0
 */
@RestController
public class BusinessShareholderApiImpl implements BusinessShareholderApi {

    @Autowired
    BusinessShareholderService businessShareholderService;


    @Override
    public List<BusinessShareholder> list(@RequestBody BusinessShareholderFilter filter) {
        return  businessShareholderService.list(filter);
    }

    @Override
    public List<BusinessShareholder> findByEnterInfo(@RequestParam("enterId") Long enterId) {
        return businessShareholderService.findByEnterId(enterId);
    }

    @Override
    public BusinessShareholder save(@RequestBody BusinessShareholder param) {
        return businessShareholderService.save(param);
    }

    @Override
    public BusinessShareholder findById(@RequestParam("id") Long id) {
        return businessShareholderService.find(id);
    }


    @Override
    public void delete(Long id) {
        businessShareholderService.delete(id);
    }

    @Override
    public void saveList(@RequestBody BaseUpdateInfo<BusinessShareholder> updateInfo) {
        businessShareholderService.saveList(updateInfo);
    }

    @Override
    public PageResult<BusinessShareholder> search(@RequestBody BusinessShareholderFilter filter, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {
        return businessShareholderService.findByEnterInfoPage(filter, pageNo, pageSize);
    }


}
